<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="http://cdn.staticfile.org/jquery/3.6.1/jquery.js"></script>

    <style>
        .changeColor {
            background-color: aqua;
        }
    </style>
</head>

<body>
    <div>制作随着鼠标移动聚焦的列表</div>
    <ul>
        <li>元素1</li>
        <li>元素2</li>
        <li>元素3</li>
        <li>元素4</li>
    </ul>

    <script>
        $(function () {
            $("ul li").mouseover(function(){
                $(this).addClass("changeColor")
            }).mouseout(function (){
                $(this).removeClass("changeColor")
            })
        })
    </script>

</body>

</html>